package com.huike.pmps.controller;

import com.huike.pmps.model.dto.common.PageInfo;
import com.huike.pmps.model.entity.Supplier;
import com.huike.pmps.model.entity.SupplierEvaluates;
import com.huike.pmps.model.vo.Result;
import com.huike.pmps.service.SupplierEvaluatesService;
import com.huike.pmps.service.SupplierService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 作者：谌贵斌(黑桃K)
 * 日期: 2888-08-08
 * 老师QQ: 272488352
 * 官方QQ交流群: 377748272
 * 刀客程序员官网：http://www.daoke360.com
 * 刀客程序员淘宝旗舰店：https://daoke360.taobao.com/
 */
@Api(tags = "供应商评价管理")
@RestController
@RequestMapping("/api/supplierEvaluates")
public class SupplierEvaluatesController {

    @Autowired
    SupplierEvaluatesService supplierEvaluateService;

    @ApiOperation(value = "按课程供应商查找供应商评价", httpMethod = "GET")
    @GetMapping("/{courseId}")
    public Result selectBySupplierType(@PathVariable("courseId") Integer courseId) {
        return supplierEvaluateService.querySupplierEvaluatesByCourseId(courseId);
    }

    @ApiOperation(value = "按搜索条件查询评分数据", httpMethod = "GET")
    @GetMapping("/supplierEvaluatesDetails/{supplierId}")
    public Result selectBySupplierId(@PathVariable("supplierId") Integer supplierTypeId) {
        System.out.println("============"+ supplierTypeId);
        return supplierEvaluateService.selectBySupplierId(supplierTypeId);
    }

    @ApiOperation(value = "供应商评分批量提交", httpMethod = "POST")
    @PostMapping("/suppliersEvaluate/batchUpdate")
    public Result suppliersEvaluate(@RequestBody List<SupplierEvaluates> info) {
        System.out.println(info);
        return supplierEvaluateService.batchUpdate(info);
    }

//    @ApiOperation(value = "添加供应商", httpMethod = "POST")
//    @PostMapping
//    public Result insertOne(SupplierEvaluates supplierEvaluates) {
//        return supplierEvaluateService.insertOne(supplierEvaluates);
//    }
//
//    @ApiOperation(value = "获取供应商详细信息", httpMethod = "GET")
//    @GetMapping("{id}")
//    public Result selectOneById(@PathVariable("id") Integer id) {
//        return supplierEvaluateService.selectOneById(id);
//    }
//
//
//    @ApiOperation(value = "根据供应商ID删除供应商数据", httpMethod = "DELETE")
//    @DeleteMapping("/{supplierId}")
//    public Result deleteByRoleId(@PathVariable("supplierId") Integer supplierId) {
//        return supplierEvaluateService.deleteById(supplierId);
//    }
//
//
//    @ApiOperation(value = "根据供应商ID，修改供应商信息", httpMethod = "PUT")
//    @PutMapping
//    public Result updateById(SupplierEvaluates supplierEvaluates) {
//        return supplierEvaluateService.updateById(supplierEvaluates);
//    }
//
//
//    @ApiOperation(value = "供应商启用或禁用", httpMethod = "PATCH")
//    @ApiImplicitParam(name = "state", value = "供应商状态", paramType = "query", dataType = "int", required = true)
//    @PatchMapping("/state/{supplierId}")
//    public Result updateStateByRoleId(@PathVariable("supplierId") Integer supplierEvaluatesId, Integer state) {
//        SupplierEvaluates supplierEvaluates = SupplierEvaluates.builder().id(supplierEvaluatesId).build();
//        return supplierEvaluateService.updateById(supplierEvaluates);
//    }
//

//
//    @ApiOperation(value = "按供应商类型查找供应商", httpMethod = "GET")
//    @GetMapping("/supplier_type/{supplierTypeId}")
//    public Result selectBySupplierType(@PathVariable("supplierTypeId") Integer supplierTypeId) {
//        return supplierEvaluateService.selectBySupplierType(supplierTypeId);
//    }

}
